package com.atguigu.guli.service.edu.controller.api;

import com.atguigu.commonutils.result.R;
import com.atguigu.guli.service.edu.service.TeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author: Mr.Wang
 * @date: 2021-06-08 22:39
 * @description:
 */
@CrossOrigin
@Api(tags = "讲师")
@RestController
@RequestMapping("/api/edu/teacher")
public class ApiTeacherController {
    @Autowired
    private TeacherService teacherService;

    @ApiOperation("查询所有教师")
    @GetMapping("/list")
    public R findAll() {
        return R.ok().data("items",teacherService.list());
    }

    @ApiOperation("根据Id获得教师详情信息")
    @GetMapping("get/{id}")
    public R get(@ApiParam(value = "讲师ID", required = true)
                @PathVariable String id) {
        Map<String, Object> map = teacherService.selectTeacherInfoById(id);
        return R.ok().data(map);
    }
}
